<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    new Promise((resolve, reject) => {
        setTimeout(()=>{
            // resolve 和 reject 只会执行一个。只要执行了A就不会执行B，执行了B就不会执行A
            resolve('Hello jAVA');
            reject("error msg")
        },1000)
    }).then(data => console.log(data),error => console.log(error))
    //.then(成功执行的函数,异常执行的函数)
</script>
</html>
